/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array
   @Language: C++
   @Datetime: 19-06-04 17:47
   */

class Solution {
public:
	vector<int> searchRange(vector<int>& nums, int target) {
		auto i=lower_bound(nums.begin(),nums.end(),target);
		auto j=upper_bound(nums.begin(),nums.end(),target);
		if(i==j) return {-1,-1};
		return {i-nums.begin(),j-nums.begin()-1};
	}
};
